asm
  ld sp,$47FF
  end asm

#include "./library/pacmandelay.bas"
#include "./library/smsrnd.bas"
#include "./library/charmapquizo01.bas"
#include "./library/quizosldir79b.bas"


dim eee as uinteger at $4010
dim seed as uinteger at $4012
dim ee0 as uinteger at $4014
dim ee1 as uinteger at $4016
dim ee2 as uinteger at $4018
dim ee3 as uinteger at $401A
dim eex as uinteger at $401C
dim eey as uinteger at $401E


sub quizoputchar(txp1 as uinteger,typ1 as uinteger,tch1 as uinteger,tad1 as uinteger):
  quizosldir79b($C000+(txp1*2)+(typ1*640),tad1+(tch1*32),8 )
  end sub



'sub quizoputchar(txp1 as uinteger,typ1 as uinteger,tch1 as uinteger,tad1 as uinteger):
'  dim te2 as uinteger at $4000
'  dim te3 as uinteger at $4002
'  dim tee as uinteger at $4004
'  tee=0
'    for te2=0 to 7
'      for te3=0 to 1
'        out $70,0
'        poke $C000+(te3)+(txp1*2)+(te2*80)+(typ1*640),peek(tad1+tee+(tch1*32))
'        tee=tee+1
'        out $70,8
'        poke $C000+(te3)+(txp1*2)+(te2*80)+(typ1*640),peek(tad1+tee+(tch1*32))
'        tee=tee+1
'        next:next
'  end sub


seed=0

do

for ee0=0 to 24
  for ee1=0 to 39
    seed=smsrnd(seed)
    quizoputchar(ee1,ee0,seed mod 32,@charmap01)
    next:next

for ee0=0 to 15
  for ee1=0 to 15
    quizoputchar(ee1+20,ee0+8,ee0*16+ee1,@charmap01)
    next:next


eex=8:eey=8

eee=0
do

quizoputchar(1,1,48+(int(eee/100) mod 10),@charmap01)
quizoputchar(2,1,48+(int(eee/10) mod 10),@charmap01)
quizoputchar(3,1,48+(eee mod 10),@charmap01)

ee0=in($00) bxor 255
quizoputchar(1,3,48+(int(ee0/100) mod 10),@charmap01)
quizoputchar(2,3,48+(int(ee0/10) mod 10),@charmap01)
quizoputchar(3,3,48+(ee0 mod 10),@charmap01)

eey=eey-((ee0 band 8)/8)

ee0=in($10) bxor 255
quizoputchar(1,4,48+(int(ee0/100) mod 10),@charmap01)
quizoputchar(2,4,48+(int(ee0/10) mod 10),@charmap01)
quizoputchar(3,4,48+(ee0 mod 10),@charmap01)

eex=eex-((ee0 band 1)/1)+((ee0 band 2)/2)
eey=eey+((ee0 band 4)/4)


ee0=in($40)
quizoputchar(1,5,48+(int(ee0/100) mod 10),@charmap01)
quizoputchar(2,5,48+(int(ee0/10) mod 10),@charmap01)
quizoputchar(3,5,48+(ee0 mod 10),@charmap01)


quizoputchar(eex,eey,eee mod 128,@charmap01)

if eex<0 then:eex=0:end if
if eey<0 then:eey=0:end if
if eex>39 then:eex=39:end if
if eey>24 then:eey=24:end if

eee=eee+1
loop

do:loop



'---------------------------------------------------------------------------

loop


do

eex=0
for ee0=0 to 23
  for ee1=0 to 39
    eee=0
    seed=smsrnd(seed)
    for ee2=0 to 7
      for ee3=0 to 1
        out $70,0
        poke $C000+(ee3)+(ee1*2)+(ee2*80)+(ee0*640),peek(@charmap01+eee+((eex mod 64)*32))
        eee=eee+1
        out $70,8
        poke $C000+(ee3)+(ee1*2)+(ee2*80)+(ee0*640),peek(@charmap01+eee+((eex mod 64)*32))
        eee=eee+1
        next:next
    eex=eex+1
    pacmandelay(50000)
    next:next


loop


'-------------------------------------

tile01:
asm

defb %1111,0,%1100,0
defb %1100,0,%0110,0
defb %1100,0,%0110,0
defb %1100,0,%0110,0
defb %1111,0,%1100,0
defb %1100,0,%0000,0
defb %1100,0,%0000,0
defb %0000,0,%0000,0


end asm


